{% extends "base.html" %}
{% block title %}编辑书籍{% endblock %}
{% block content %}
<h2>编辑书籍</h2>
<form method="POST" action="{{ url_for('book_manage.book_edit', book_id=book.id) }}">
    {{ form.hidden_tag() }}
    <p>
        {{ form.name.label }}<br>
        {{ form.name(size=32) }}<br>
        {% for error in form.name.errors %}
            <span style="color: red;">[{{ error }}]</span>
        {% endfor %}
    </p>
    <p>
        {{ form.book_type_id.label }}<br>
        {{ form.book_type_id(size=32) }}<br>
        {% for error in form.book_type_id.errors %}
            <span style="color: red;">[{{ error }}]</span>
        {% endfor %}
    </p>
    <p>
        {{ form.author.label }}<br>
        {{ form.author(size=32) }}<br>
        {% for error in form.author.errors %}
            <span style="color: red;">[{{ error }}]</span>
        {% endfor %}
    </p>
    <p>
        {{ form.price.label }}<br>
        {{ form.price(size=32) }}<br>
        {% for error in form.price.errors %}
            <span style="color: red;">[{{ error }}]</span>
        {% endfor %}
    </p>
    <p>
        {{ form.available_count.label }}<br>
        {{ form.available_count(size=32) }}<br>
        {% for error in form.available_count.errors %}
            <span style="color: red;">[{{ error }}]</span>
        {% endfor %}
    </p>
    <p>
        {{ form.is_active.label }}<br>
        {{ form.is_active() }}<br>
        {% for error in form.is_active.errors %}
            <span style="color: red;">[{{ error }}]</span>
        {% endfor %}
    </p>
    <p>{{ form.submit() }}</p>
</form>
<!-- 添加删除表单 -->
<form action="{{ url_for('book_manage.book_delete', book_id=book.id) }}" method="post" style="display:inline;">
    {{ form.hidden_tag() }}
    <button type="submit">删除</button>
</form>

<a href="{{ url_for('book_manage.book_list') }}">返回书籍列表</a>
{% endblock %}
